#ifndef DFTCALC_H_INCLUDED
#define DFTCALC_H_INCLUDED

#include "fftw3.h"
#include <sndfile.hh>

#include <math.h>
#include <malloc.h>
#include <iostream>
#include <stdio.h>

class DftCalc
{
        public:
        DftCalc(int DftMsecsWindow, int SampleRate, int BytesPerSample, int NumChannels);
        virtual ~DftCalc();

        void* calculate_DFT_Mod(void *data);
        void* calculate_DFT_Phase(void *data);

        void* calculate_DCT_Mod(void *data);

        int getDftWindow_NumTimeSamplesBytes() { return DftWindow_NumTimeSamplesBytes; }
        int getDftWindow_NumFreqSamples() { return DftWindow_NumFreqSamples; }

        private:
            void appendToWav();

            int DftMsecsWindow;
            int SampleRate;
            int BytesPerSample;
            int NumChannels;

            int DftWindow_NumTimeSamples;
            int DftWindow_NumTimeSamplesBytes;
            int DftWindow_NumFreqSamples;
            int DftWindow_HertzPerSample;
            int BytesForDft;

            double *fftInData;
            fftw_complex *fftOutData;
            fftw_plan fftPlan;

            double *dctInData;
            double *dctOutData;
            fftw_plan dctPlan;


            SndfileHandle *outWavFile;
            int outWavFileWritten;
            int outWavFileWrittenCount;


};


#endif // DFTCALC_H_INCLUDED
